Skip to content

Commit

Permalink
Setup version handling and ensure common package information (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
Danielku15 committed Oct 14, 2023
1 parent 7022982 commit 48a9e2d
Show file tree
Hide file tree
Showing 58 changed files with 1,111 additions and 108 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ on:
description: Use Skia Binary from cache
default: false

jobs:
env:
ALPHASKIA_VERSION: 1.0.0.${{ github.run_number }}

jobs:
#
# Windows
windows-skia:
Expand Down Expand Up @@ -216,9 +218,9 @@ jobs:
- run: ./build.cmd Java
- uses: actions/upload-artifact@v3
with:
name: Jars
name: Maven
path: |
lib/java/*/build/libs/*.jar
lib/java/dist/**/*.*
node:
runs-on: ubuntu-latest
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -713,6 +713,9 @@ fabric.properties

!/build
!/lib
/wrapper/include/generated
/lib/java/**/test-outputs
/lib/java/local.properties
/lib/node/**/test-outputs
/lib/node/*.tgz
/lib/node/*/*.tgz
/lib/dotnet/Version.props
12 changes: 12 additions & 0 deletions .nuke/build.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
"GnExe": {
"type": "string"
},
"GnVerbose": {
"type": "boolean"
},
"GradlewExe": {
"type": "string"
},
Expand Down Expand Up @@ -56,6 +59,9 @@
"VSCode"
]
},
"IsReleaseBuild": {
"type": "boolean"
},
"JavaHome": {
"type": "string"
},
Expand All @@ -68,6 +74,9 @@
"NinjaExe": {
"type": "string"
},
"NinjaVerbose": {
"type": "boolean"
},
"NoLogo": {
"type": "boolean",
"description": "Disables displaying the NUKE logo"
Expand All @@ -93,6 +102,9 @@
"PythonExe": {
"type": "string"
},
"Rebuild": {
"type": "boolean"
},
"Root": {
"type": "string",
"description": "Root directory during build execution"
Expand Down
102 changes: 102 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
BSD 3-Clause License

Copyright (c) 2023, Daniel Kuschny

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


# Skia

Copyright (c) 2011 Google Inc. All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.

* Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

# Harfbuzz

Copyright © 2010-2022 Google, Inc.
Copyright © 2015-2020 Ebrahim Byagowi
Copyright © 2019,2020 Facebook, Inc.
Copyright © 2012,2015 Mozilla Foundation
Copyright © 2011 Codethink Limited
Copyright © 2008,2010 Nokia Corporation and/or its subsidiary(-ies)
Copyright © 2009 Keith Stribley
Copyright © 2011 Martin Hosken and SIL International
Copyright © 2007 Chris Wilson
Copyright © 2005,2006,2020,2021,2022,2023 Behdad Esfahbod
Copyright © 2004,2007,2008,2009,2010,2013,2021,2022,2023 Red Hat, Inc.
Copyright © 1998-2005 David Turner and Werner Lemberg
Copyright © 2016 Igalia S.L.
Copyright © 2022 Matthias Clasen
Copyright © 2018,2021 Khaled Hosny
Copyright © 2018,2019,2020 Adobe, Inc
Copyright © 2013-2015 Alexei Podtelezhnikov

For full copyright notices consult the individual files in the package.


Permission is hereby granted, without written agreement and without
license or royalty fees, to use, copy, modify, and distribute this
software and its documentation for any purpose, provided that the
above copyright notice and the following two paragraphs appear in
all copies of this software.

IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE.

THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# AlphaSkia
# alphaSkia

> ℹ️ This library is still work in progress and not yet available.
AlphaSkia is a special cross platform [Skia](https://skia.org/) wrapper used in [AlphaTab](https://github.com/CoderLine/alphaTab) it aims to provide a HTML5 Canvas like API to alphaTab providing a consistent rendering experience across the alphaTab flavours like web, .net and Kotlin. Differences across operating systems might still apply.
alphaSkia is a special cross platform [Skia](https://skia.org/) wrapper used in [alphaTab](https://github.com/CoderLine/alphaTab) it aims to provide a HTML5 Canvas like API to alphaTab providing a consistent rendering experience across the alphaTab flavours like web, .net and Kotlin. Differences across operating systems might still apply.

A big **Thank you** to the following projects giving me good insights on how to build Skia in a cross platform fashion. These projects influenced heavily
how the pipelines of AlphaSkia are organized.
## Credits
A big _"Thank you"_ to the following projects giving me good insights on how to build Skia in a cross platform fashion. These projects influenced heavily how the pipelines of alphaSkia are organized.

* [SkiaSharp](https://github.com/mono/SkiaSharp/)
* [Skija](https://github.com/HumbleUI/Skija/)
Expand Down
42 changes: 41 additions & 1 deletion build/Build.DotNet.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Nuke.Common;
using Nuke.Common.IO;
using Nuke.Common.Tooling;
using Nuke.Common.Tools.DotNet;

Expand Down Expand Up @@ -32,10 +33,49 @@ partial class Build
.DependsOn(PrepareGitHubArtifacts)
.Executes(() =>
{
DotNetWriteVersionInfoProps();
DotNetTasks.DotNetBuild(_ => _
.SetProcessWorkingDirectory(RootDirectory / "lib" / "dotnet")
.SetConfiguration("Release")
.SetForce(Rebuild)
);
});


void DotNetWriteVersionInfoProps()
{
string semVer;
if (IsLocalBuild)
{
semVer = $"{VersionInfo.FileVersion.ToString(3)}-local.{VersionInfo.FileVersion.Revision}";
}
else if (!IsReleaseBuild)
{
semVer = $"{VersionInfo.FileVersion.ToString(3)}-alpha.{VersionInfo.FileVersion.Revision}";
}
else
{
semVer = $"{VersionInfo.FileVersion.ToString(3)}";
}

var props = $"""
<Project>
<PropertyGroup>
<Version>{semVer}</Version>
<AssemblyVersion>{VersionInfo.FileVersion.ToString(2)}</AssemblyVersion>
<FileVersion>{VersionInfo.FileVersion.ToString(4)}</FileVersion>
<Authors>{VersionInfo.AuthorName}</Authors>
<Company>{VersionInfo.Company}</Company>
<Product>{VersionInfo.ProductName}</Product>
<ProductDescription>{VersionInfo.Description}</ProductDescription>
<Copyright>{VersionInfo.Copyright}</Copyright>
<PackageLicenseExpression>{VersionInfo.LicenseSpdx}</PackageLicenseExpression>
<PackageProjectUrl>{VersionInfo.ProjectUrl}</PackageProjectUrl>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>{VersionInfo.GitUrlHttp}</RepositoryUrl>
</PropertyGroup>
</Project>
""";
(RootDirectory / "lib" / "dotnet" / "Version.props").WriteAllText(props);
}
}
43 changes: 42 additions & 1 deletion build/Build.Java.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ partial class Build
.DependsOn(JavaBuild)
.Executes(() =>
{
GradlewTool("assemble",
GradlewTool("publishAllPublicationsToDistPathRepository",
workingDirectory: RootDirectory / "lib" / "java");
});

Expand All @@ -29,7 +29,48 @@ partial class Build
.DependsOn(PrepareGitHubArtifacts)
.Executes(() =>
{
JavaWriteVersionInfoProperties();
if (Rebuild)
{
GradlewTool("clean",
workingDirectory: RootDirectory / "lib" / "java");
}
GradlewTool("build",
workingDirectory: RootDirectory / "lib" / "java");
});

void JavaWriteVersionInfoProperties()
{
string semVer;
if (IsLocalBuild)
{
semVer = $"{VersionInfo.FileVersion.ToString(3)}-LOCAL";
}
else if (!IsReleaseBuild)
{
semVer = $"{VersionInfo.FileVersion.ToString(3)}-SNAPSHOT";
}
else
{
semVer = $"{VersionInfo.FileVersion.ToString(3)}";
}

var props = $"""
alphaskiaDescription={VersionInfo.Description}
alphaskiaAuthorId={VersionInfo.AuthorId}
alphaskiaAuthorName={VersionInfo.AuthorName}
alphaskiaOrgUrl={VersionInfo.OrgUrl}
alphaskiaCompany={VersionInfo.Company}
alphaskiaVersion={semVer}
alphaskiaProjectUrl={VersionInfo.ProjectUrl}
alphaskiaGitUrlHttp={VersionInfo.GitUrlHttp}
alphaskiaGitUrlGit"={VersionInfo.GitUrlGit}
alphaskiaLicenseSpdx={VersionInfo.LicenseSpdx}
alphaskiaLicenseUrl={VersionInfo.LicenseUrl}
alphaskiaIssuesUrl={VersionInfo.IssuesUrl}
""";
(RootDirectory / "lib" / "java" / "local.properties").WriteAllText(props);
}
}
Loading

0 comments on commit 48a9e2d

Please sign in to comment.