Repository navigation
Generate the SWIG wrappers again for 51degrees-cxx 4.5.101 - #22
Draft
jwrosewell wants to merge 4 commits into
Draft
jwrosewell wants to merge 4 commits into
jwrosewell wants to merge 4 commits into
Conversation
The workflow builds SWIG 4.5.1 from its tag, checks that it gives the committed wrappers with cxx at 4110d681, then generates them with cxx at 4e023aaa and commits them. It is removed again before the pull request is opened.
With cxx at 4110d681 the Java files come out byte for byte the same as the committed ones, and the two C++ files differ only in the comments where SWIG records the path it read JavaTypes.i from. The committed files give that path with Windows separators. The workflow now checks that those comments are the only difference before it commits.
51degrees-cxx 4.5.101 removes the process overloads of EngineHash and EngineIpi that take required property indexes. The committed wrappers still call them, so the native libraries would not compile once cxx moves to that release. This moves cxx to 4e023aaa5c1f5ec56d475c75a91761d8ef55dc20, the head of the 4.5.101 release pull request in 51degrees-cxx, and generates both wrappers again from its interfaces with SWIG 4.5.1 built on Linux. Device Detection uses the RebuildSwig command in its CMakeLists.txt, run from the repository root, and IP Intelligence uses the command in its RegenSwig.ps1, run from its cxx folder. With cxx at 4110d6813e167a803a06489318b33b83a230fa32 the same commands give the committed Java files byte for byte. The two C++ files differ only in the comments where SWIG records the path it read JavaTypes.i from. The committed files were generated by a Windows build of SWIG with the include flag -I../../../../.., which gives that path as ../../../../..\cxx\src\common\JavaTypes.i, so those comments change here as well.
ben51degrees
approved these changes
Nov 3, 2026
Contributor
|
@jwrosewell I've left this in draft, so it won't be included in todays release. Please mark as ready if there are no more changes, and I'll rerun the pipeline to publish |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The 4.5.101 release of 51degrees-cxx, which is not merged or tagged yet, removes the C++
processoverloads that take required property indexes. At 4e023aaa the engines keep only these overloads.src/dd/hash/EngineHash.hppline 161process(EvidenceDeviceDetection *evidence)and line 166process(const char *userAgent)src/ipi/EngineIpi.hppline 177process(EvidenceIpi *evidence), line 189process(const char *ipAddress)and the byte address form at line 207The wrappers on
mainwere generated from 4.5.100 (4110d681) in fe9d0cbd. They still call the removed overloads, so the native libraries will not compile oncecxxmoves to 4.5.101.Java_Hash_Engine.cpplines 16611 and 16685Java_Ipi_Engine.cpplines 26114, 26188 and 26298. Line 26042 is the byte address form, which stays.The Java proxies declare them too, in
EngineHashSwig.javalines 97 and 102 andEngineIpiSwig.javalines 102, 107 and 112, with their JNI module classes.What was checked
DeviceDetectionHashEngine.javaline 327 andIPIntelligenceOnPremiseEngine.javaline 317 callengine.process(relevantEvidence), andDeviceDataHashDefault.javaandIPIntelligenceDataHashDefault.javaread values by property name. GitHub code search findsSWIGTYPE_p_intandrequiredPropertyIndexesonly in generated files.src/dd/hash/ConfigHash.i,src/dd/hash/EngineHash.i,src/ipi/EngineIpi.iandsrc/ipi/ResultsIpi.i, and the last of them only gains comments. No interface in cxx includes a C or C++ header for SWIG to parse, so header changes alter the generated wrappers only through these four files.cxxat 4110d681 the commands below, writing to a separate folder, give all 89 committed Java files byte for byte./*@SWIG:<path>,28,JAVA_UBYTE_ARR_TYPEMAP_BODY@*/, where SWIG records the path it readJavaTypes.ifrom. There are 4 such lines inJava_Hash_Engine.cppand 8 inJava_Ipi_Engine.cpp. With that path replaced, both files are byte for byte the same as the committed ones.../../../../..\cxx\src\common\JavaTypes.i. The backslashes are the separator a Windows build of SWIG uses (swigfile.hlines 37 to 41), and the prefix is the include flag-I../../../../... SWIG opens an included file relative to the current folder first and only then tries the include folders (include.clines 173 to 180), so the recorded path also depends on the folder SWIG runs in. Nothing points to a different SWIG version, different flags or an interface edited by hand.interop/swigfolders carries SWIG's generated header and is one the generation makes, so removing them before generating again removes nothing written by hand.What changed
cxxmoves from 4110d681 (4.5.100) to 4e023aaa, the head of therelease/4.5.101branch of 51degrees-cxx, and both wrappers are generated again in 0aae3377. The generated.javafiles and the two.cppfiles were removed first, asRegenSwig.ps1does. These are the commands, where<root>is the repository root.The Device Detection command runs from the repository root, so SWIG finds
JavaTypes.iby its relative path and writes no path from the machine into those comments.Device Detection
EngineHashSwig.process(EvidenceDeviceDetectionSwig, SWIGTYPE_p_int, int)andprocess(String, SWIGTYPE_p_int, int), their nativesEngineHashSwig_process__SWIG_2andEngineHashSwig_process__SWIG_3, and their C++ functions.SWIGTYPE_p_int.java, which nothing else uses.EngineHashSwig.getProfileIdsForPropertyValue(String propertyName, String valueName), which returns the newVectorUInt32Swig, a wrapper forstd::vector<uint32_t>.setPropertyValueIndex(boolean),getPropertyValueIndex(),setIndexedProperties(VectorStringSwig)andgetIndexedProperties()toConfigHashSwig.IP Intelligence
EngineIpiSwig.process(EvidenceIpiSwig, SWIGTYPE_p_int, int),process(String, SWIGTYPE_p_int, int)andprocess(byte[], IpTypeSwig, SWIGTYPE_p_int, int), their nativesEngineIpiSwig_process__SWIG_3toEngineIpiSwig_process__SWIG_5, and their C++ functions.SWIGTYPE_p_int.java.ResultsIpi.iis comments only.Both C++ files
/*@SWIG:...@*/comments now givecxx/src/common/JavaTypes.ifor Device Detection and../../../../../cxx/src/common/JavaTypes.ifor IP Intelligence, for the reason above. They are comments, so nothing that is compiled changes.How it was verified
swig-wrappersartifact holds both sets of output and the diffs. An earlier run found the comment difference and stopped without committing. The temporary workflow that did this was removed again in 55a4b3a1, so the branch changes onlycxxand the wrappers.nightly-pull-request.ymlwithdryrun: 'true', so nothing is merged. Its Configure job setPullRequestShato 55a4b3a, the head of this pull request, withcxxat 4e023aaa.mainat 3df49028, which usedcxxat 4.5.100.What remains
cxxat the 4.5.101 tag once it is published. If the release changes before it merges, generate the wrappers again with the commands above.tmp/pr-matrix-22branch holds the workflow that started the build above, and changing itsname:line starts a new run.