Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split projects, migrate to Kotlin DSL #33

Merged
merged 1 commit into from
Feb 16, 2020
Merged

Conversation

vlsi
Copy link
Contributor

@vlsi vlsi commented Feb 15, 2020

The following changes happen here:

  • darklaf-windows is extracted to its own project. That helps to confine Windows-specific code
  • darklaf-native-utils is extracted to its own project as well so darklaf-windows and core can depend on it
  • build scripts are migrated to java-library
  • cpp-library does not work with java-library , so compileOnly+runtimeOnly is used instead of api/implementation.
  • build scripts are migrated to Kotlin DSL

Note: I think it makes sense to move core into its own subfolder (e.g. core), however, that change is not included here.
It would co-locate folders like core/src/ and core/build.

@vlsi vlsi force-pushed the refactor_build branch 25 times, most recently from f0958f6 to 838c6c8 Compare February 16, 2020 10:43
@vlsi
Copy link
Contributor Author

vlsi commented Feb 16, 2020

@weisJ , I don't have a Windows machine with C++ toolchain installed.

Can you please check if darklaf-windows module builds ok?
I expect it should build both x86 and x86-64 libraries (if both toolchains are available).

In other words: ./gradlew :darklaf-windows:build, then check windows/build/libs/darklaf-...jar for dlls.

@weisJ
Copy link
Owner

weisJ commented Feb 16, 2020

Yes the module is build correctly.

@vlsi vlsi force-pushed the refactor_build branch 2 times, most recently from 96e0dd5 to 1826855 Compare February 16, 2020 13:57
@vlsi
Copy link
Contributor Author

vlsi commented Feb 16, 2020

I guess the PR is more or less ready.

Release to Central should work.

If you have Docker, you can test the release with https://github.com/vlsi/asflike-release-environment#switching-tlps

The doc is here: https://github.com/vlsi/vlsi-release-plugins/tree/master/plugins/stage-vote-release-plugin#making-a-release-candidate

Basically:

  1. ./gradlew prepareVote -Prc=1 -Pgh. -Pgh stands for "push to GitHub and Central". If you omit -Pgh, it will push to localhost (~asflike-...)
    It would create and populate staging repository in Nexus, so you would be able to review it and even drop it.

  2. ./gradlew publishDist -Prc=1 -Pgh would release the staging repository.

@vlsi
Copy link
Contributor Author

vlsi commented Feb 16, 2020

At which point does signing of binaries happen?

You can add --dry-run (or -m) to see the approximate order of the tasks.

Also could you explain what properties I need to set in my own gradle.properties file?

https://github.com/vlsi/vlsi-release-plugins/tree/master/plugins/stage-vote-release-plugin#recommended-configuration

However please use gh prefix instead of asf.
I guess it should print the list of missing properties at the very start of prepareVote.

And prepareVote is the only step that needs signing keys (it signs artifacts and pushes them to the staging repository). The release task does not need signing.

because it has no configured signatory

Oh. It looks like it can't find a keyring file.

I have the following in my ~/.gradle/gradle.properties

signing.gnupg.keyName=AC2AEE0F
signing.keyId=AC2AEE0F
signing.password=
signing.secretKeyRingFile=/Users/vladimirsitnikov/.gnupg/secring.gpg
ghTestGitSourceUsername=
ghTestGitSourcePassword=
ghTestNexusUsername=
ghTestNexusPassword=
ghGitSourceUsername=
ghGitSourcePassword=
ghNexusUsername=
ghNexusPassword=

build.gradle.kts Outdated

val buildVersion = "darklaf".v + releaseParams.snapshotSuffix
println("Building Darklaf $buildVersion")
println(" OS: " + System.getProperty("os.name"))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm inclined to remove this as the user often knows which OS they are using.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be removed, no problem :)

@weisJ
Copy link
Owner

weisJ commented Feb 16, 2020

Ok great that worked. Thank you!
Though is it intended that debug binaries are also released?
https://oss.sonatype.org/content/repositories/comgithubweisj-1035/com/github/weisj/

Also a separate repository was created that is empty. Is this something that can be avoided? (If not it's not a big deal.)

How exactly does the voting process work? I'm still pretty new to this kind of stuff.

filteringCharset = "UTF-8"
textFrom("licenses/NOTICE.txt")
textFrom("licenses/PBJAR_LICENSE.txt")
textFrom("licenses/INTELLIJ_LICENSE.txt")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

textFrom("licenses/DARCULA_LICENSE.txt") is missing here.

@weisJ
Copy link
Owner

weisJ commented Feb 16, 2020

Note: I think it makes sense to move core into its own subfolder (e.g. core), however, that change is not included here.
It would co-locate folders like core/src/ and core/build.

This would mean the parent project just adds darklaf-core as it's dependency and acts as a bundle for the components?

Edit: Forgot to mention that I do like the idea :)

@vlsi
Copy link
Contributor Author

vlsi commented Feb 16, 2020

Though is it intended that debug binaries are also released?
https://oss.sonatype.org/content/repositories/comgithubweisj-1035/com/github/weisj/

Well, that was not intended. I don't think it makes sense to release .dll as a separate artifacts to Central.

My intention was to package lib and dll (is just a dll enough?) into darlaf-windows.jar.

However, in practice https://oss.sonatype.org/content/repositories/comgithubweisj-1035/com/github/weisj/darklaf-windows/1.3.3.4/darklaf-windows-1.3.3.4.jar includes windows-x86/darklaf-windows.lib twice.

Note: I think it is worth shipping debug libraries for the following reasons:

  • Performance is not that important
  • Debug would help in case of failure (e.g. core dump, etc, etc)

However, I thought I disabled publications of the individual dlls.

How exactly does the voting process work? I'm still pretty new to this kind of stuff.

It does not have to be a formal vote, however in Apache Software Foundation they have a requirement that each release have to pass a vote. That is release manager prepares the release artifacts, then other committers verify the artifacts and express their opinions.

It is like you shared a staging repository above. Now we know that the build script publishes a little bit too many files, and the contents of darklaf-windows.jar is not good.

@vlsi
Copy link
Contributor Author

vlsi commented Feb 16, 2020

This would mean the parent project just adds darklaf-core as it's dependency and acts as a bundle for the components?

The root project does not have to add darklaf-core as a dependency.
The root would enforce the common configuration.

Edit: Forgot to mention that I do like the idea :)

Ok, cool. I suggest splitting the core to its own subfolder after this PR is merged.
Otherwise, the PR diff would be hard to see in GitHub UI (it will be full of trivial renames).

@weisJ
Copy link
Owner

weisJ commented Feb 16, 2020

My intention was to package lib and dll (is just a dll enough?) into darlaf-windows.jar.

The dll should be enough as that is the one that is being loaded.

However, in practice https://oss.sonatype.org/content/repositories/comgithubweisj-1035/com/github/weisj/darklaf-windows/1.3.3.4/darklaf-windows-1.3.3.4.jar includes windows-x86/darklaf-windows.lib twice.

So instead of the lib twice the dll should be included.

It is like you shared a staging repository above. Now we know that the build script publishes a little bit too many files, and the contents of darklaf-windows.jar is not good.

Ok thank you for the clarification.

The root project does not have to add darklaf-core as a dependency.

After testing it, it seems as if darklaf-core is needed when building the fat jar.

@vlsi
Copy link
Contributor Author

vlsi commented Feb 16, 2020

building the fat jar.

What do you intend to use a fat jar for?

Fat jars do not play well with licensing: you have to obey the licenses for third parties you bundle.

@vlsi
Copy link
Contributor Author

vlsi commented Feb 16, 2020

@weisJ , could you share ./gradlew prepareVote -Prc=1 --dry-run output?

@weisJ
Copy link
Owner

weisJ commented Feb 16, 2020

19:58:49: Executing task 'prepareVote --project-prop rc=1 --dry-run'...

> Task :buildSrc:extractPrecompiledScriptPluginPlugins UP-TO-DATE
> Task :buildSrc:generateExternalPluginSpecBuilders UP-TO-DATE
> Task :buildSrc:compilePluginsBlocks UP-TO-DATE
> Task :buildSrc:generatePrecompiledScriptPluginAccessors UP-TO-DATE
> Task :buildSrc:configurePrecompiledScriptDependenciesResolver
> Task :buildSrc:generateScriptPluginAdapters UP-TO-DATE
> Task :buildSrc:compileKotlin UP-TO-DATE
> Task :buildSrc:compileJava NO-SOURCE
> Task :buildSrc:compileGroovy NO-SOURCE
> Task :buildSrc:pluginDescriptors UP-TO-DATE
> Task :buildSrc:processResources UP-TO-DATE
> Task :buildSrc:classes UP-TO-DATE
> Task :buildSrc:inspectClassesForKotlinIC UP-TO-DATE
> Task :buildSrc:jar UP-TO-DATE
> Task :buildSrc:assemble UP-TO-DATE
> Task :buildSrc:compileTestKotlin NO-SOURCE
> Task :buildSrc:pluginUnderTestMetadata UP-TO-DATE
> Task :buildSrc:compileTestJava NO-SOURCE
> Task :buildSrc:compileTestGroovy NO-SOURCE
> Task :buildSrc:processTestResources NO-SOURCE
> Task :buildSrc:testClasses UP-TO-DATE
> Task :buildSrc:test NO-SOURCE
> Task :buildSrc:validatePlugins UP-TO-DATE
> Task :buildSrc:check UP-TO-DATE
> Task :buildSrc:build UP-TO-DATE

> Configure project :
Building Darklaf 1.3.3.4
             OS: Windows 10
            JDK: C:\Program Files\Java\java-1.8.0-openjdk-1.8.0.242-1.b08.ojdkbuild.windows.x86_64\jre
:validateBeforeBuildingReleaseArtifacts SKIPPED
:preparePreviewSiteRepo SKIPPED
:syncPreviewSiteRepo SKIPPED
:pushPreviewSite SKIPPED
:darklaf-native-utils:compileJava SKIPPED
:darklaf-windows:compileJava SKIPPED
:compileJava SKIPPED
:processResources SKIPPED
:classes SKIPPED
:jar SKIPPED
:javadoc SKIPPED
:javadocJar SKIPPED
:sourcesJar SKIPPED
:generateMetadataFileForDarklafPublication SKIPPED
:generatePomFileForDarklafPublication SKIPPED
:validateNexusCredentials SKIPPED
:initializeNexusStagingRepository SKIPPED
:signDarklafPublication SKIPPED
:publishDarklafPublicationToNexusRepository SKIPPED
:publish SKIPPED
:darklaf-native-utils:processResources SKIPPED
:darklaf-native-utils:classes SKIPPED
:darklaf-native-utils:jar SKIPPED
:darklaf-native-utils:javadoc SKIPPED
:darklaf-native-utils:javadocJar SKIPPED
:darklaf-native-utils:sourcesJar SKIPPED
:darklaf-native-utils:generateMetadataFileForDarklaf-native-utilsPublication SKIPPED
:darklaf-native-utils:generatePomFileForDarklaf-native-utilsPublication SKIPPED
:darklaf-native-utils:initializeNexusStagingRepository SKIPPED
:darklaf-native-utils:signDarklaf-native-utilsPublication SKIPPED
:darklaf-native-utils:publishDarklaf-native-utilsPublicationToNexusRepository SKIPPED
:darklaf-native-utils:publish SKIPPED
:darklaf-windows:processResources SKIPPED
:darklaf-windows:classes SKIPPED
:darklaf-windows:compileDebugX86Cpp SKIPPED
:darklaf-windows:linkDebugX86 SKIPPED
:darklaf-windows:compileDebugX86-64Cpp SKIPPED
:darklaf-windows:linkDebugX86-64 SKIPPED
:darklaf-windows:compileReleaseX86Cpp SKIPPED
:darklaf-windows:linkReleaseX86 SKIPPED
:darklaf-windows:compileReleaseX86-64Cpp SKIPPED
:darklaf-windows:linkReleaseX86-64 SKIPPED
:darklaf-windows:jar SKIPPED
:darklaf-windows:javadoc SKIPPED
:darklaf-windows:javadocJar SKIPPED
:darklaf-windows:sourcesJar SKIPPED
:darklaf-windows:generateMetadataFileForDarklaf-windowsPublication SKIPPED
:darklaf-windows:generatePomFileForDarklaf-windowsPublication SKIPPED
:darklaf-windows:initializeNexusStagingRepository SKIPPED
:darklaf-windows:signDarklaf-windowsPublication SKIPPED
:darklaf-windows:publishDarklaf-windowsPublicationToNexusRepository SKIPPED
:darklaf-windows:generateMetadataFileForMainDebugX86-64Publication SKIPPED
:darklaf-windows:generatePomFileForMainDebugX86-64Publication SKIPPED
:darklaf-windows:signMainDebugX86-64Publication SKIPPED
:darklaf-windows:publishMainDebugX86-64PublicationToNexusRepository SKIPPED
:darklaf-windows:generateMetadataFileForMainDebugX86Publication SKIPPED
:darklaf-windows:generatePomFileForMainDebugX86Publication SKIPPED
:darklaf-windows:signMainDebugX86Publication SKIPPED
:darklaf-windows:publishMainDebugX86PublicationToNexusRepository SKIPPED
:darklaf-windows:cppHeaders SKIPPED
:darklaf-windows:generateMetadataFileForMainPublication SKIPPED
:darklaf-windows:generatePomFileForMainPublication SKIPPED
:darklaf-windows:signMainPublication SKIPPED
:darklaf-windows:publishMainPublicationToNexusRepository SKIPPED
:darklaf-windows:generateMetadataFileForMainReleaseX86-64Publication SKIPPED
:darklaf-windows:generatePomFileForMainReleaseX86-64Publication SKIPPED
:darklaf-windows:signMainReleaseX86-64Publication SKIPPED
:darklaf-windows:publishMainReleaseX86-64PublicationToNexusRepository SKIPPED
:darklaf-windows:generateMetadataFileForMainReleaseX86Publication SKIPPED
:darklaf-windows:generatePomFileForMainReleaseX86Publication SKIPPED
:darklaf-windows:signMainReleaseX86Publication SKIPPED
:darklaf-windows:publishMainReleaseX86PublicationToNexusRepository SKIPPED
:darklaf-windows:publish SKIPPED
:closeRepository SKIPPED
:validateRcIndexSpecified SKIPPED
:validateSvnCredentials SKIPPED
:stageSvnDist SKIPPED
:createRcTag SKIPPED
:pushRcTag SKIPPED
:stageDist SKIPPED
:generateVoteText SKIPPED
:prepareVote SKIPPED

BUILD SUCCESSFUL in 8s
19:58:58: Task execution finished 'prepareVote --project-prop rc=1 --dry-run'.

@weisJ
Copy link
Owner

weisJ commented Feb 16, 2020

building the fat jar.

What do you intend to use a fat jar for?

Fat jars do not play well with licensing: you have to obey the licenses for third parties you bundle.

You are probably right with this. In this case the shadow plugin isn't needed anymore.

@weisJ
Copy link
Owner

weisJ commented Feb 16, 2020

I think the problem is with:
filter { it.isDebuggable }, as also the release versions return true for it.
It may be worth changing the filter to it.isOptimized.(As an alternative one could filter by it.name.contains("Debug")).
Also going from

from(binary.linkFile)

to

from(binary.linkFile
    .map { it.asFile }
    .map { it.parentFile.toPath().resolve( "${it.nameWithoutExtension}.dll") })
}
from(path)

copies the dll instead of the lib file.

Edit: Yes this resolves it. https://oss.sonatype.org/content/repositories/comgithubweisj-1036/com/github/weisj/darklaf-windows/1.3.3.4/darklaf-windows-1.3.3.4.jar

@vlsi
Copy link
Contributor Author

vlsi commented Feb 16, 2020

it.isOptimized

Can you please try { it.isDebuggable && it.isOptimized }

Also going from from(binary.linkFile) to

Can you please try from(binary.runtimeFile) ?

@weisJ
Copy link
Owner

weisJ commented Feb 16, 2020

@vlsi working

@weisJ
Copy link
Owner

weisJ commented Feb 16, 2020

Does this conclude the PR?

@vlsi
Copy link
Contributor Author

vlsi commented Feb 16, 2020

Does this conclude this PR?

Not yet.
As far as I see, binary.runtimeFile is the same as binary.linkFile :(

Does binary.runtimeFile return a name of .dll for you?

@vlsi
Copy link
Contributor Author

vlsi commented Feb 16, 2020

Just in case: can you please perform yet another ./gradlew prepareVote -Prc=2 -Pgh so we doublecheck that individual dlls are not published anymore?

@vlsi vlsi changed the title WIP: split projects, migrate to Kotlin DSL Split projects, migrate to Kotlin DSL Feb 16, 2020
@weisJ
Copy link
Owner

weisJ commented Feb 16, 2020

binary.runtimeFile does return a .dll for me. Here is the new rc https://oss.sonatype.org/content/repositories/comgithubweisj-1038/

@weisJ weisJ merged commit 74ad3a6 into weisJ:master Feb 16, 2020
@vlsi
Copy link
Contributor Author

vlsi commented Feb 16, 2020

Ok, great. rc2 looks wonderful to me.
I'm not sure windows lib works, but it can be fixed later if it does not :)

@vlsi
Copy link
Contributor Author

vlsi commented Feb 16, 2020

One more thing: the missing bit is copying of the generated-pom.xml to their respective locations.
Do you need that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

What do you think of kotlin DSL for Gradle scripts?
2 participants