Skip to content

Commit

Permalink
Build and use asset graph (major internal change)
Browse files Browse the repository at this point in the history
Now the command graph and the asset graph are separate.
The hopen files create the command graph; the command graph
creates the asset graph; and the asset graph creates the
blueprint files (e.g., `Makefile`).

Appveyor:
 - Always run with the latest Data::Hopen from Github

Dependencies:
 - Test: +Test::Exception
 - Runtime: +Class::Tiny::ConstrainedAccessor, +vars::i

Architectural changes:
 - Split asset graph off from command graph
 - Rename `Op`s in A::h to `Cmd`s or `Node`s to help keep everything straight

Code changes include:
 - Add system environment to DAG's scope
 - Give each hopen-file package a unique name, just in case the same
   hopen file is run twice.  This is setting up for eventually being
   able to run multiple phases with a single invocation of hopen(1).
 - Remove some apparently-unused dependencies from Makefile.PL
 - Add Appveyor badge to README
 - Bump required version of Data::Hopen
 - Add App::hopen::Asset, and its type constraints
 - Asset: permit storing App::hopen::Util::BasedPath instances directly
 - Add --build option
 - BasedPath: add orig_cwd; enforce requirement that path parameter be
   a relative path.
 - t/lib/HopenTest: Remove the creation of the "DUT" package alias since
   it prevents BUILD from being called correctly in Class::Tiny
   subclasses.  Just use `$DUT->foo` instead.
 - Begin adding tests of A::h::H
 - Added A::h::G::Cmd with make(), {made}, {made_by}, and run()
 - Added A::h::G::AssetOp with constrained `asset` accessor
 - Added A::h::Gen::Make::AssetGraphNode
 - Updated tests per changes to Data::Hopen::Scope 2019-03-08
 - A::h::Gen::asset() can update C<how> on existing AssetOp instances

Tests:
 - Removed tests left over from Data::Hopen - we don't need to run the
   same tests here as well.
  • Loading branch information
Chris White committed May 26, 2019
1 parent d6c0de8 commit 257173d
Show file tree
Hide file tree
Showing 49 changed files with 1,352 additions and 785 deletions.
10 changes: 9 additions & 1 deletion .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,17 @@ image:

# === Basics ===

# no install; it's platform-specific
# no install here; it's platform-specific

build_script:
# Grab the latest Data::Hopen
- svn export --force https://github.com/hopenbuild/Data-Hopen/trunk/lib
# Thanks to https://stackoverflow.com/a/39317180/2877364

# Grab the rest of the dependencies
- cpanm --installdeps --notest --verbose .

# Build it
- perl Makefile.PL
- cmd: gmake
- sh: make
Expand Down Expand Up @@ -73,3 +80,4 @@ for:

# Then, install cpanminus locally so it will be cached.
- which cpanm || (curl -L https://cpanmin.us | perl - App::cpanminus)

23 changes: 13 additions & 10 deletions Changes
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
Revision history for App-hopen

0.000009 2019-??-??
Split former Build-Hopen into App-hopen and Data-Hopen
0.000010 2019-05-26
First non-trial release.
Major internal changes. Finished removing Data-Hopen leftovers.

0.000008 2019-02-09
Tweak File::Glob usage to support Perl 5.14
0.000009 2019-02-24 (TRIAL RELEASE)
Split former Build-Hopen into App-hopen and Data-Hopen

0.000007 2019-02-08
First version that can generate a Makefile
0.000008 2019-02-09 (TRIAL RELEASE)
Tweak File::Glob usage to support Perl 5.14

0.000006 2019-02-06
Substantially expanded
0.000007 2019-02-08 (TRIAL RELEASE)
First version that can generate a Makefile

0.000003 2018-01-02
First full trial release
0.000006 2019-02-06 (TRIAL RELEASE)
Substantially expanded

0.000003 2018-01-02 (TRIAL RELEASE)
First full trial release
24 changes: 11 additions & 13 deletions MANIFEST
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@ bin/hopen
Changes
lib/App/hopen.pm
lib/App/hopen/AppUtil.pm
lib/App/hopen/Asset.pm
lib/App/hopen/BuildSystemGlobals.pm
lib/App/hopen/Conventions.pod
lib/App/hopen/G/FilesOp.pm
lib/App/hopen/G/AssetOp.pm
lib/App/hopen/G/Cmd.pm
lib/App/hopen/G/FilesCmd.pm
lib/App/hopen/Gen.pm
lib/App/hopen/Gen/Make.pm
lib/App/hopen/Gen/Make/AssetGraphNode.pm
lib/App/hopen/Gen/Make/AssetGraphVisitor.pm
lib/App/hopen/H.pm
lib/App/hopen/HopenFileKit.pm
lib/App/hopen/Phase.pod
Expand All @@ -15,6 +20,8 @@ lib/App/hopen/Phase/Gen.pm
lib/App/hopen/Phases.pm
lib/App/hopen/T/Gnu.pm
lib/App/hopen/T/Gnu/C.pm
lib/App/hopen/T/Gnu/C/CompileCmd.pm
lib/App/hopen/T/Gnu/C/LinkCmd.pm
lib/App/hopen/Tool.pm
lib/App/hopen/Toolchain.pm
lib/App/hopen/Util/BasedPath.pm
Expand All @@ -25,22 +32,13 @@ MANIFEST.SKIP
README Autogenerated
README.md Autogenerated
support/readme.pl
t/00-load.t
t/001-entity.t
t/002-link.t
t/003-node.t
t/004-goal.t
t/00-load-ah.t
t/005-op.t
t/006-collect-op.t
t/007-hnew.t
t/008-nameset.t
t/009-hopen-constants.t
t/010-scope-hash.t
t/011-scope-env.t
t/012-scope-nested.t
t/020-dag.t
t/021-dag-single-goal.t
t/030-util-basedpath.t
t/040-ah-g-assetop.t
t/100-h.t
t/200-apputil-basic.t
t/dir200/inner.hopen.pl
t/dir200/inner/.hopen.pl
Expand Down
77 changes: 54 additions & 23 deletions Makefile.PL
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!perl
# Makefile.PL for Build::Hopen
# Makefile.PL for App::hopen
use 5.014;
use strict;
use warnings;
Expand All @@ -9,6 +9,8 @@ use File::Spec;

my $VERSION_FROM = File::Spec->catfile(qw(lib App hopen.pm));
my $IS_TRIAL = check_trial();
my $secure_perl_path = get_perl_filename();
my @provides = ();

# Check if this is a TRIAL version {{{1
sub check_trial {
Expand All @@ -26,16 +28,18 @@ sub check_trial {
}
return 0;
} #check_trial()

# }}}1
# Module metadata {{{1
my $provides;
eval {
require Module::Metadata;
$provides = Module::Metadata->provides(version => '2', dir => 'lib');
@provides =
(provides => Module::Metadata->provides(version => '2', dir => 'lib'));
# Thanks to https://stackoverflow.com/a/28928985/2877364 by LEONT
# for suggesting Module::Metadata.
};
# }}}1

# }}}1
# Get the filename of the Perl interpreter running this. {{{1
# Modified from perlvar.
# The -x test is for cygwin or other systems where $Config{perlpath} has no
Expand All @@ -49,10 +53,9 @@ sub get_perl_filename {
($secure_perl_path =~ m/$Config{_exe}$/i);
}
return $secure_perl_path;
} # get_perl_filename() }}}1

my $secure_perl_path = get_perl_filename();
} # get_perl_filename()

# }}}1
# Makefile customization (MY) {{{1
{ package MY;

Expand Down Expand Up @@ -103,7 +106,7 @@ testhere: # Run the tests from lib rather than blib
\tprove -lj4
README.md: @{[$VERSION_FROM]} Makefile.PL $make_readme_md
\t"$secure_perl_path" "$make_readme_md" -i "\$<" -o "\$@" -f md
\t"$secure_perl_path" "$make_readme_md" -i "\$<" -o "\$@" -f md --appveyor cxw42/app-hopen --avbadge hopenbuild/app-hopen
README: @{[$VERSION_FROM]} Makefile.PL $make_readme_md
\t"$secure_perl_path" "$make_readme_md" -i "\$<" -o "\$@" -f text
Expand Down Expand Up @@ -133,7 +136,9 @@ actually_uninstall_from_vendordirs ::
EOT

} #postamble()
} #package MY }}}1
} #package MY

# }}}1

# Main options for EUMM
my %opts = (
Expand All @@ -152,13 +157,19 @@ my %opts = (
# - backtracking control verbs (5.010)
# - working smartmatch (5.010001)
# - stringifying regexes with modifiers (5.014)
# - FH->autoflush without needing IO::Handle (see
# perldoc -f select) (5.014)

# In the following, if a specific version is listed, but no explanation
# is given, that means we want that version for bugfixes it includes.
# Prereqs commented out with "##" were used at one time but no longer
# appear to be.
CONFIGURE_REQUIRES => {
'Config' => '0',
'ExtUtils::MakeMaker' => '0',
'File::Spec' => '0',
'strict' => '0',
'warnings' => '0',
},
BUILD_REQUIRES => {
'Getopt::Long' => '0',
Expand All @@ -173,13 +184,15 @@ my %opts = (
'rlib' => '0',
'Scalar::Util' => '0',
'Test::Deep' => '0.084', # for superhashof
'Test::Directory' => '0.02', # for subdirs
## 'Test::Directory' => '0.02', # for subdirs
'Test::Exception' => '0',
'Test::More' => '0',
# Test::TempDir::Tiny? If so, remove Test::Directory dependency?
'Test::Warn' => '0.35', # for metadata
},
PREREQ_PM => {
# Other hopen packages -------------------
'Data::Hopen' => '0.000009',
'Data::Hopen' => '0.000013',

# Non-hopen dependencies -----------------
#'Algorithm::Dependency' => '1.106',
Expand All @@ -195,30 +208,29 @@ my %opts = (
# - Looks like it might be handy.
# 0.002+ because that has only core dependencies.

#'Class::Method::Modifiers' => '1.05', # version nums from Antlers
#'Role::Tiny' => '1.000000',
'Class::Tiny::ConstrainedAccessor' => '0.000010', # custom constraints

'Class::XPath' => '1.4',
## 'Class::XPath' => '1.4',
'Config' => '0',
'Cwd' => '0',

'constant' => '0',
'Data::Dumper' => '0',
'Deep::Hash::Utils' => '0.03', # For correct metadata
'experimental' => '0.009', # For support on perl < 5.15.7
## 'experimental' => '0.009', # For support on perl < 5.15.7
'Exporter' => '0',
'feature' => '0',
# 'File::Find::Rule' => '0', # - might be nice for finding files
'File::Glob' => '0',
#'File::Globstar' => '0.5', # Fewer dependencies
'File::Path::Tiny' => '0.9',
'File::pushd' => '1.013',
'File::Spec' => '0',
'File::stat' => '0',
'File::Which' => '1.22', # for msys2 support
'Hash::Merge' => '0.299',
'Hash::Ordered' => '0.011',
'Import::Into' => '0',
'IO::Handle' => '0',
'Getargs::Mixed' => '1.04', # For -undef_ok option
'Getopt::Long' => '2.5', # For long option bugfix
'Graph' => '0.9704', # For latest multiedged support
Expand Down Expand Up @@ -250,15 +262,22 @@ my %opts = (
# 'Probe::Perl' => '0', # For perl interpreter file location or other info.
# Alternative: Padre::Perl

'Quote::Code' => '1.01',
#'Role::Tiny' => '1.000000',

'Scalar::Util' => '0',
'Set::Scalar' => '1.27', # For correct metadata
'Storable' => '3.06',
## 'Storable' => '3.06',
# So it can handle REGEXP -
# https://rt.perl.org/Public/Bug/Display.html?id=50608

'Sub::ScopeFinalizer' => '0.02', # For correct META.yml
'String::Print' => '0.92',
## 'Sub::ScopeFinalizer' => '0.02', # For correct META.yml

'strict' => '0',
'Type::Tiny' => '1.004004',

'vars::i' => '1.06',
'warnings' => '0',
},

Expand All @@ -267,12 +286,12 @@ my %opts = (

resources => {
bugtracker => {
web => 'https://github.com/hopenbuild/Build-Hopen/issues',
web => 'https://github.com/hopenbuild/App-hopen/issues',
},
repository => {
type => 'git',
url => 'https://github.com/hopenbuild/Build-Hopen.git',
web => 'https://github.com/hopenbuild/Build-Hopen',
url => 'https://github.com/hopenbuild/App-hopen.git',
web => 'https://github.com/hopenbuild/App-hopen',
},
},

Expand All @@ -285,15 +304,27 @@ my %opts = (
},
},

$provides ? (provides => $provides) : (),
@provides,

}, #META_MERGE

dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
clean => { FILES => 'Build-Hopen-*' },
clean => { FILES => 'App-hopen-*' },
); # %opts

$opts{META_MERGE}->{release_status} = 'testing' if $IS_TRIAL;

# Some tests run on older versions of EUMM that do not support TEST_REQUIRES.
# This is a workaround, modified from
# https://metacpan.org/source/RJBS/JSON-Typist-0.005/Makefile.PL ,
# linked from http://blogs.perl.org/users/neilb/2017/05/specifying-dependencies-for-your-cpan-distribution.html .
# If we are on a version of EUMM that doesn't support TEST_REQUIRES,
# move those dependencies to PREREQ_PM.
unless( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) {
$opts{PREREQ_PM}->{$_} = $opts{TEST_REQUIRES}->{$_}
foreach keys %{$opts{TEST_REQUIRES}};
delete $opts{TEST_REQUIRES};
}

WriteMakefile(%opts);
# vi: set fdm=marker fdl=0: #
5 changes: 5 additions & 0 deletions README
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
NAME
App::hopen - hopen build system command-line interface

(Note: most features are not yet implemented ;) . However it will
generate a Makefile for a basic "Hello, World" program at this point!)

hopen is a cross-platform software build generator. It makes files you
can pass to Make, Ninja, Visual Studio, or other build tools, to compile
and link your software. hopen gives you:
Expand All @@ -26,6 +29,8 @@ USAGE

If no destination directory is specified, "<project dir>/built" is used.

See App::hopen::Conventions for more details.

OPTIONS
-a "architecture"
Specify the architecture. This is an arbitrary string interpreted by
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
# App::hopen - hopen build system command-line interface

[![Appveyor Badge](https://ci.appveyor.com/api/projects/status/github/hopenbuild/app-hopen?svg=true)](https://ci.appveyor.com/project/cxw42/app-hopen)



(Note: most features are not yet implemented ;) . However it will generate
a Makefile for a basic `Hello, World` program at this point!)

hopen is a cross-platform software build generator. It makes files you can
pass to Make, Ninja, Visual Studio, or other build tools, to compile and
link your software. hopen gives you:
Expand All @@ -25,6 +30,8 @@ If no project directory is specified, the current directory is used.

If no destination directory is specified, `<project dir>/built` is used.

See [App::hopen::Conventions](https://github.com/hopenbuild/App-hopen/blob/master/lib/App/hopen/Conventions.pod) for more details.

# OPTIONS

- -a `architecture`
Expand Down
Loading

0 comments on commit 257173d

Please sign in to comment.