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 liquibase-core and liquibase-commercial jar files #3050

Merged
merged 23 commits into from Jul 20, 2022
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
19cf99d
DAT-10497 change liquibase-pro to liquibase-commercial in relevant pl…
ap-liquibase Jun 8, 2022
b689b5c
DAT-10497 add liquibase-commercial as a dependency to lb oss release pom
ap-liquibase Jun 8, 2022
4e8f172
Merge branch 'master' into github-action-DAT-10497
nvoxland Jul 7, 2022
77fa075
Working on commercial vs. core jar split
nvoxland Jul 7, 2022
0e72fa5
Working on commercial vs. core jar split
nvoxland Jul 7, 2022
a94ff4a
Working on commercial vs. core jar split
nvoxland Jul 8, 2022
d54afbf
Working on commercial vs. core jar split
nvoxland Jul 11, 2022
306e957
Working on commercial vs. core jar split
nvoxland Jul 11, 2022
f835ce8
Working on commercial vs. core jar split
nvoxland Jul 11, 2022
a5cb088
Working on commercial vs. core jar split
nvoxland Jul 11, 2022
445ea96
Updating release logic for new liquibase-core/liquibase-commerical jars
nvoxland Jul 12, 2022
b3826b7
Updating release logic for new liquibase-core/liquibase-commerical jars
nvoxland Jul 13, 2022
0cba1f4
Updating release logic for new liquibase-core/liquibase-commerical jars
nvoxland Jul 13, 2022
1c44a24
Updating release logic for new liquibase-core/liquibase-commerical jars
nvoxland Jul 13, 2022
d78faaf
Merge remote-tracking branch 'origin/master' into github-action-DAT-1…
nvoxland Jul 13, 2022
57b9e5a
Merged master into branch
nvoxland Jul 13, 2022
eeeb69a
Updating release logic for new liquibase-core/liquibase-commerical jars
nvoxland Jul 13, 2022
ecb0f83
Working on commercial vs. core jar split
nvoxland Jul 14, 2022
a3bd00d
Merge remote-tracking branch 'origin/master' into github-action-DAT-1…
nvoxland Jul 14, 2022
f4669ad
Updated "XSD not found" error message to include missing extensions
nvoxland Jul 15, 2022
94df4b4
Updated "XSD not found" error message to include missing extensions
nvoxland Jul 16, 2022
1a9a005
Updated "XSD not found" error message to include missing extensions
nvoxland Jul 16, 2022
68556e4
Merge branch 'master' into github-action-DAT-10497
nvoxland Jul 20, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 12 additions & 10 deletions .github/util/re-version.sh
Expand Up @@ -43,22 +43,22 @@ mkdir -p $outdir
(cd $scriptDir && javac ManifestReversion.java)

#### Update jars
declare -a jars=("liquibase-0-SNAPSHOT.jar" "liquibase-0-SNAPSHOT-sources.jar" "liquibase-cdi-0-SNAPSHOT.jar" "liquibase-cdi-0-SNAPSHOT-sources.jar" "liquibase-maven-plugin-0-SNAPSHOT.jar" "liquibase-maven-plugin-0-SNAPSHOT-sources.jar")
declare -a jars=("liquibase-core-0-SNAPSHOT.jar" "liquibase-core-0-SNAPSHOT-sources.jar" "liquibase-commercial-0-SNAPSHOT.jar" "liquibase-cdi-0-SNAPSHOT.jar" "liquibase-cdi-0-SNAPSHOT-sources.jar" "liquibase-maven-plugin-0-SNAPSHOT.jar" "liquibase-maven-plugin-0-SNAPSHOT-sources.jar")

for jar in "${jars[@]}"
do
## MANIFEST.MF settings
unzip -q $workdir/$jar META-INF/* -d $workdir

java -cp $scriptDir ManifestReversion $workdir/META-INF/MANIFEST.MF $version
find $workdir/META-INF -name pom.xml -exec sed -i -e "s/<version>0-SNAPSHOT<\/version>/<version>$version<\/version>/" {} \;
find $workdir/META-INF -name pom.properties -exec sed -i -e "s/0-SNAPSHOT/$version/" {} \;
find $workdir/META-INF -name plugin*.xml -exec sed -i -e "s/<version>0-SNAPSHOT<\/version>/<version>$version<\/version>/" {} \;
find $workdir/META-INF -name pom.xml -exec sed -i -e "s/<version>0-SNAPSHOT<\/version>/<version>$version<\/version>/g" {} \;
find $workdir/META-INF -name pom.properties -exec sed -i -e "s/0-SNAPSHOT/$version/g" {} \;
find $workdir/META-INF -name plugin*.xml -exec sed -i -e "s/<version>0-SNAPSHOT<\/version>/<version>$version<\/version>/g" {} \;
(cd $workdir && jar -uMf $jar META-INF)
rm -rf $workdir/META-INF

## Fix up liquibase.build.properties
if [ $jar == "liquibase-0-SNAPSHOT.jar" ]; then
if [[ $jar == "liquibase-core-0-SNAPSHOT.jar" || $jar == "liquibase-commercial-0-SNAPSHOT.jar" ]]; then
unzip -q $workdir/$jar liquibase.build.properties -d $workdir
sed -i -e "s/build.version=.*/build.version=$version/" $workdir/liquibase.build.properties
(cd $workdir && jar -uf $jar liquibase.build.properties)
Expand All @@ -79,15 +79,15 @@ do
done

#### Update javadoc jars
declare -a javadocJars=("liquibase-0-SNAPSHOT-javadoc.jar" "liquibase-cdi-0-SNAPSHOT-javadoc.jar" "liquibase-maven-plugin-0-SNAPSHOT-javadoc.jar")
declare -a javadocJars=("liquibase-core-0-SNAPSHOT-javadoc.jar" "liquibase-cdi-0-SNAPSHOT-javadoc.jar" "liquibase-maven-plugin-0-SNAPSHOT-javadoc.jar")

for jar in "${javadocJars[@]}"
do
mkdir $workdir/rebuild
unzip -q $workdir/$jar -d $workdir/rebuild

find $workdir/rebuild -name "*.html" -exec sed -i -e "s/0-SNAPSHOT/$version/" {} \;
find $workdir/rebuild -name "*.xml" -exec sed -i -e "s/<version>0-SNAPSHOT<\/version>/<version>$version<\/version>/" {} \;
find $workdir/rebuild -name "*.html" -exec sed -i -e "s/0-SNAPSHOT/$version/g" {} \;
find $workdir/rebuild -name "*.xml" -exec sed -i -e "s/<version>0-SNAPSHOT<\/version>/<version>$version<\/version>/g" {} \;

(cd $workdir/rebuild && jar -uf ../$jar *)
rm -rf $workdir/rebuild
Expand Down Expand Up @@ -132,12 +132,14 @@ done


##### update zip/tar files
cp $outdir/liquibase-$version.jar $workdir/liquibase.jar ##save versioned jar as unversioned to include in zip/tar
cp $outdir/liquibase-core-$version.jar $workdir/internal/lib/liquibase-core.jar ##save versioned jar as unversioned to include in zip/tar
cp $outdir/liquibase-commercial-$version.jar $workdir/internal/lib/liquibase-commercial.jar ##save versioned jar as unversioned to include in zip/tar

## Extract tar.gz and rebuild it back into the tar.gz and zip
mkdir $workdir/tgz-repackage
(cd $workdir/tgz-repackage && tar -xzf $workdir/liquibase-0-SNAPSHOT.tar.gz)
cp $workdir/liquibase.jar $workdir/tgz-repackage/liquibase.jar
cp $workdir/liquibase-core.jar $workdir/tgz-repackage/internal/lib/liquibase-core.jar
cp $workdir/liquibase-commercial.jar $workdir/tgz-repackage/internal/lib/liquibase-commercial.jar
find $workdir/tgz-repackage -name "*.txt" -exec sed -i -e "s/0-SNAPSHOT/$version/" {} \;
(cd $workdir/tgz-repackage && tar -czf $outdir/liquibase-$version.tar.gz *)
(cd $workdir/tgz-repackage && zip -qr $outdir/liquibase-$version.zip *)
33 changes: 23 additions & 10 deletions .github/workflows/build.yml
Expand Up @@ -320,22 +320,22 @@ jobs:
env:
GPG_PASSWORD: ${{ secrets.GPG_PASSPHRASE }}

- name: Download liquibase-pro
- name: Download liquibase-commercial
uses: liquibase/action-download-artifact@v2-liquibase
with:
github_token: ${{ secrets.BOT_TOKEN }}
workflow: build.yml
workflow_conclusion: success
branch: "${{ needs.setup.outputs.proBranchName }}"
name: liquibase-pro-modules
path: download/liquibase-pro
name: liquibase-commercial-modules
path: download/liquibase-commercial
repo: liquibase/liquibase-pro

- name: Install Built Modules
run: |
(find . -name *-SNAPSHOT.jar -exec mvn -B org.apache.maven.plugins:maven-install-plugin:3.0.0-M1:install-file -Dfile={} \;)
(find . -name *-SNAPSHOT-sources.jar -exec mvn -B org.apache.maven.plugins:maven-install-plugin:3.0.0-M1:install-file -Dclassifier=sources -Dfile={} \;)
mvn -B org.apache.maven.plugins:maven-install-plugin:3.0.0-M1:install-file -Dfile=download/liquibase-pro/liquibase-pro-0-SNAPSHOT.jar
mvn -B org.apache.maven.plugins:maven-install-plugin:3.0.0-M1:install-file -Dfile=download/liquibase-commercial/liquibase-commercial-0-SNAPSHOT.jar

- name: Build & Sign Artifacts
env:
Expand All @@ -355,7 +355,7 @@ jobs:

echo "Saving windows key"
echo "$INSTALL4J_WINDOWS_KEY" | base64 -d > liquibase-dist/target/keys/datical_windows.pfx
mvn -B -pl liquibase-dist -P liquibase-pro source:jar package
mvn -B -pl liquibase-dist -P liquibase-commercial source:jar package

## extract tar content for other artifacts
mkdir -p liquibase-dist/target/liquibase-0-SNAPSHOT
Expand All @@ -372,8 +372,11 @@ jobs:
mkdir -p artifacts
cp liquibase-dist/target/liquibase-0-SNAPSHOT.tar.gz artifacts
cp liquibase-dist/target/liquibase-0-SNAPSHOT.zip artifacts
cp liquibase-dist/target/liquibase-0-SNAPSHOT.jar artifacts
cp liquibase-dist/target/liquibase-0-SNAPSHOT-sources.jar artifacts

cp liquibase-dist/target/liquibase-0-SNAPSHOT.jar artifacts/liquibase-core-0-SNAPSHOT.jar
cp liquibase-dist/target/liquibase-0-SNAPSHOT-sources.jar artifacts/liquibase-core-0-SNAPSHOT-sources.jar
cp target/liquibase-0-SNAPSHOT-javadoc.jar artifacts/liquibase-core-0-SNAPSHOT-javadoc.jar

cp liquibase-dist/target/liquibase-*-installer-* artifacts

cp liquibase-maven-plugin/target/liquibase-maven-plugin-0-SNAPSHOT.jar artifacts
Expand All @@ -383,19 +386,29 @@ jobs:
cp liquibase-cdi/target/liquibase-cdi-0-SNAPSHOT.jar artifacts
cp liquibase-cdi/target/liquibase-cdi-0-SNAPSHOT-sources.jar artifacts
cp liquibase-cdi/target/liquibase-cdi-0-SNAPSHOT-javadoc.jar artifacts


echo "Source code not available for liquibase-commercial" > /tmp/readme.source.txt
(cd /tmp && jar cf liquibase-commercial-0-SNAPSHOT-sources.jar readme.source.txt)

cp target/liquibase-0-SNAPSHOT-javadoc.jar artifacts
echo "Javadocs not available for liquibase-commercial" > /tmp/readme.javadocs.txt
(cd /tmp && jar cf liquibase-commercial-0-SNAPSHOT-javadoc.jar readme.javadocs.txt)

cp download/liquibase-commercial/liquibase-commercial-0-SNAPSHOT.jar artifacts
cp /tmp/liquibase-commercial-0-SNAPSHOT-sources.jar artifacts
cp /tmp/liquibase-commercial-0-SNAPSHOT-javadoc.jar artifacts

.github/util/sign-artifacts.sh artifacts

##prepare branch-named convenience artifacts directories
mkdir artifacts-named
cp liquibase-dist/target/liquibase-0-SNAPSHOT.tar.gz artifacts-named/liquibase-${{ needs.setup.outputs.thisBranchFileName }}.tar.gz
cp liquibase-dist/target/liquibase-0-SNAPSHOT.jar artifacts-named/liquibase-${{ needs.setup.outputs.thisBranchFileName }}.jar
cp liquibase-dist/target/liquibase-0-SNAPSHOT.jar artifacts-named/liquibase-core-${{ needs.setup.outputs.thisBranchFileName }}.jar
cp liquibase-maven-plugin/target/liquibase-maven-plugin-0-SNAPSHOT.jar artifacts-named/liquibase-maven-plugin-${{ needs.setup.outputs.thisBranchFileName }}.jar
cp liquibase-cdi/target/liquibase-cdi-0-SNAPSHOT.jar artifacts-named/liquibase-cdi-${{ needs.setup.outputs.thisBranchFileName }}.jar
cp liquibase-extension-testing/target/liquibase-extension-testing-0-SNAPSHOT.jar artifacts-named/liquibase-extension-testing-${{ needs.setup.outputs.thisBranchFileName }}.jar
cp liquibase-extension-testing/target/liquibase-extension-testing-0-SNAPSHOT-deps.jar artifacts-named/liquibase-extension-testing-${{ needs.setup.outputs.thisBranchFileName }}-deps.jar
cp download/liquibase-commercial/liquibase-commercial-0-SNAPSHOT.jar artifacts-named/liquibase-commercial-${{ needs.setup.outputs.thisBranchFileName }}.jar

- name: Archive Packages
uses: actions/upload-artifact@v3
Expand Down Expand Up @@ -474,7 +487,7 @@ jobs:
}

if (failedCheckingUs) {
console.log("Rerun liquibase-pro that was waiting on us");
console.log("Rerun liquibase-commercial that was waiting on us");

//octokit removed the retryWorkflow function
github.request("POST "+currentBranchInfo.runRerunUrl);
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/create-release.yml
Expand Up @@ -73,7 +73,8 @@ jobs:
.github/util/sign-artifacts.sh re-version/out

mkdir re-version/final
mv re-version/out/liquibase-${{ needs.setup.outputs.version }}.jar re-version/final
mv re-version/out/liquibase-core-${{ needs.setup.outputs.version }}.jar re-version/final
mv re-version/out/liquibase-commercial-${{ needs.setup.outputs.version }}.jar re-version/final
mv re-version/out/liquibase-${{ needs.setup.outputs.version }}.tar.gz re-version/final
mv re-version/out/liquibase-${{ needs.setup.outputs.version }}.zip re-version/final

Expand Down
32 changes: 24 additions & 8 deletions .github/workflows/release-published.yml
Expand Up @@ -73,9 +73,9 @@ jobs:
unzip liquibase-additional-*.zip

##extracts and sign poms
unzip -j liquibase-${version}.jar META-INF/maven/org.liquibase/liquibase-core/pom.xml
mv pom.xml liquibase-${version}.pom
gpg --batch --pinentry-mode=loopback --passphrase "$GPG_PASSWORD" -ab liquibase-${version}.pom
unzip -j liquibase-core-${version}.jar META-INF/maven/org.liquibase/liquibase-core/pom.xml
mv pom.xml liquibase-core-${version}.pom
gpg --batch --pinentry-mode=loopback --passphrase "$GPG_PASSWORD" -ab liquibase-core-${version}.pom

unzip -j liquibase-maven-plugin-${version}.jar META-INF/maven/org.liquibase/liquibase-maven-plugin/pom.xml
mv pom.xml liquibase-maven-plugin-${version}.pom
Expand All @@ -87,15 +87,31 @@ jobs:
sed -i -e "s/<description>/<name>Liquibase CDI Plugin<\/name><description>/" liquibase-cdi-${version}.pom ## name didn't end up in pom. Hack it in for now
gpg --batch --pinentry-mode=loopback --passphrase "$GPG_PASSWORD" -ab liquibase-cdi-${version}.pom

unzip -j liquibase-commercial-${version}.jar META-INF/maven/org.liquibase/liquibase-commercial/pom.xml
mv pom.xml liquibase-commercial-${version}.pom
gpg --batch --pinentry-mode=loopback --passphrase "$GPG_PASSWORD" -ab liquibase-commercial-${version}.pom

mvn -B org.apache.maven.plugins:maven-deploy-plugin:3.0.0-M1:deploy-file \
-Durl=https://oss.sonatype.org/service/local/staging/deploy/maven2/ \
-DrepositoryId=sonatype-nexus-staging \
-DpomFile=liquibase-${version}.pom \
-DpomFile=liquibase-core-${version}.pom \
-DgeneratePom=false \
-Dfile=liquibase-${version}.jar \
-Dsources=liquibase-${version}-sources.jar \
-Djavadoc=liquibase-${version}-javadoc.jar \
-Dfiles=liquibase-${version}.jar.asc,liquibase-${version}-sources.jar.asc,liquibase-${version}-javadoc.jar.asc,liquibase-${version}.pom.asc \
-Dfile=liquibase-core-${version}.jar \
-Dsources=liquibase-core-${version}-sources.jar \
-Djavadoc=liquibase-core-${version}-javadoc.jar \
-Dfiles=liquibase-core-${version}.jar.asc,liquibase-core-${version}-sources.jar.asc,liquibase-core-${version}-javadoc.jar.asc,liquibase-core-${version}.pom.asc \
-Dtypes=jar.asc,jar.asc,jar.asc,pom.asc \
-Dclassifiers=,sources,javadoc,

mvn -B org.apache.maven.plugins:maven-deploy-plugin:3.0.0-M1:deploy-file \
-Durl=https://oss.sonatype.org/service/local/staging/deploy/maven2/ \
-DrepositoryId=sonatype-nexus-staging \
-DpomFile=liquibase-commercial-${version}.pom \
-DgeneratePom=false \
-Dfile=liquibase-commercial-${version}.jar \
-Dsources=liquibase-commercial-${version}-sources.jar \
-Djavadoc=liquibase-commercial-${version}-javadoc.jar \
-Dfiles=liquibase-commercial-${version}.jar.asc,liquibase-commercial-${version}-sources.jar.asc,liquibase-commercial-${version}-javadoc.jar.asc,liquibase-commercial-${version}.pom.asc \
-Dtypes=jar.asc,jar.asc,jar.asc,pom.asc \
-Dclassifiers=,sources,javadoc,

Expand Down
Expand Up @@ -1142,7 +1142,7 @@ public String[] getVersion() throws Exception {
continue;
}
final File file = new File(url.toURI());
if (file.getName().equals("liquibase.jar")) {
if (file.getName().equals("liquibase-core.jar")) {
continue;
}
if (file.exists() && file.getName().toLowerCase().endsWith(".jar")) {
Expand Down Expand Up @@ -1195,9 +1195,11 @@ private LibraryInfo getLibraryInfo(File pathEntryFile) throws IOException {
libraryInfo.file = pathEntryFile;

final Manifest manifest = jarFile.getManifest();
libraryInfo.name = getValue(manifest, "Bundle-Name", "Implementation-Title", "Specification-Title");
libraryInfo.version = getValue(manifest, "Bundle-Version", "Implementation-Version", "Specification-Version");
libraryInfo.vendor = getValue(manifest, "Bundle-Vendor", "Implementation-Vendor", "Specification-Vendor");
if (manifest != null) {
libraryInfo.name = getValue(manifest, "Bundle-Name", "Implementation-Title", "Specification-Title");
libraryInfo.version = getValue(manifest, "Bundle-Version", "Implementation-Version", "Specification-Version");
libraryInfo.vendor = getValue(manifest, "Bundle-Vendor", "Implementation-Vendor", "Specification-Vendor");
}

if (libraryInfo.name == null) {
libraryInfo.name = pathEntryFile.getName().replace(".jar", "");
Expand Down
Expand Up @@ -32,7 +32,7 @@ public static void main(final String[] args) throws Exception {
File liquibaseHome = new File(liquibaseHomeEnv);

List<URL> urls = new ArrayList<>();
urls.add(new File(liquibaseHome, "liquibase.jar").toURI().toURL());
urls.add(new File(liquibaseHome, "internal/lib/liquibase-core.jar").toURI().toURL()); //make sure liquibase-core.jar is first in the list

File[] libDirs = new File[]{
new File("./liquibase_libs"),
Expand All @@ -54,7 +54,7 @@ public static void main(final String[] args) throws Exception {
}

for (File lib : files) {
if (lib.getName().toLowerCase(Locale.US).endsWith(".jar")) {
if (lib.getName().toLowerCase(Locale.US).endsWith(".jar") && !lib.getName().toLowerCase(Locale.US).equals("liquibase-core.jar")) {
try {
urls.add(lib.toURI().toURL());
debug("Added " + lib.getAbsolutePath() + " to classpath");
Expand Down Expand Up @@ -82,7 +82,7 @@ public static void main(final String[] args) throws Exception {

//loading with the regular system classloader includes liquibase.jar in the parent.
//That causes the parent classloader to load LiqiuabaseCommandLine which makes it not able to access files in the child classloader
//The system classloader's parent is the boot classloader, which keeps the only classloader with liquibase.jar the same as the rest of the classes it needs to access.
//The system classloader's parent is the boot classloader, which keeps the only classloader with liquibase-core.jar the same as the rest of the classes it needs to access.
final URLClassLoader classloader = new URLClassLoader(urls.toArray(new URL[0]), ClassLoader.getSystemClassLoader().getParent());
Thread.currentThread().setContextClassLoader(classloader);

Expand Down
Expand Up @@ -110,7 +110,7 @@ private void warnForMismatchedXsdVersion(String systemId) {

/**
* ResourceAccessor to use if the standard one does not have the XSD files in it.
* Returns a ClassLoaderResourceAccessor that checks the system classloader which should include the liquibase.jar.
* Returns a ClassLoaderResourceAccessor that checks the system classloader which should include the liquibase-core.jar.
*/
protected ResourceAccessor getFallbackResourceAccessor() {
if (fallbackResourceAccessor == null) {
Expand Down
Expand Up @@ -6,7 +6,7 @@ setlocal enabledelayedexpansion
rem %~dp0 is expanded pathname of the current script under NT
rem %~p0 is the directory of the current script

if exist %~p0\..\liquibase.jar SET LIQUIBASE_HOME=%~p0..
if exist %~p0\..\GETTING_STARTED.txt SET LIQUIBASE_HOME=%~p0..
nvoxland marked this conversation as resolved.
Show resolved Hide resolved

if "%LIQUIBASE_HOME%"=="" (
FOR /F "tokens=* USEBACKQ" %%g IN (`where liquibase.bat`) do (SET "LIQUIBASE_HOME=%%~dpg")
Expand Down